#include<bits/stdc++.h>
using namespace std;

int a[100];

signed main() {
	int n, k;
	cin >> n >> k;
	int sum = 0;
	for (int i = 1; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}

	int sumK = 0, tmp = 0;
	int l = 1, r = 1;
	while (r <= n) {
		while (r - l + 1 <= k) {
			tmp += a[r];
			r++;
		}
		sumK = max(sumK, tmp);
		tmp -= a[l];
		l++;
		tmp += a[r++];
	}
	cout << sum - sumK;
	return 0;
}
